package gui;

import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;

public abstract class DisplayedObject {

	public abstract void draw(Graphics2D g2d);
	
	public void drawStringMoved(Graphics2D g2d, String str, Point2D pos) {
		AffineTransform savedTransform = g2d.getTransform();
		g2d.scale(0.2,0.2);
		g2d.setFont(new Font(null,Font.PLAIN,2));
		g2d.drawString(str, (float) (5.0*pos.getX()-1), (float) (5.0*pos.getY()));
		g2d.setTransform(savedTransform);
	}
	
	public void drawString(Graphics2D g2d, String str, Point2D pos) {
		AffineTransform savedTransform = g2d.getTransform();
		g2d.scale(0.1, 0.1);
		g2d.setFont(new Font(null,Font.PLAIN,5));
		/*FontRenderContext frc = g2d.getFontRenderContext();
		Rectangle2D textBounds =*/ 
		g2d.drawString(str, (float) (10*(pos.getX()-0.35)), (float) (10*(pos.getY()+0.15)));
		g2d.setTransform(savedTransform);
	}

}
